package com.cloudkinto.enumType.order.outbound;

import com.baomidou.mybatisplus.core.enums.IEnum;
import com.cloudkinto.vo.common.CommonKvVo;

import java.util.ArrayList;

/**
 * 中转出库单状态库
 *
 * @author long
 */

public enum TransferOutboundStatusEnum implements IEnum<Integer> {

    /**
     *
     */
    zero(0, "草稿"),
    one(1, "待处理"),
    two(2, "待拣货"),
    three(3, "待出库"),
    four(4, "已出库"),
    five(5, "异常"),
    six(6, "已取消");

    private final Integer value;

    private final String desc;

    public String getDesc() {
        return desc;
    }

    TransferOutboundStatusEnum(Integer value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    @Override
    public Integer getValue() {
        return value;
    }

    public static ArrayList<CommonKvVo> getList() {
        ArrayList<CommonKvVo> list = new ArrayList<>();
        for (TransferOutboundStatusEnum inboundType : values()) {
            list.add(
                    CommonKvVo.builder()
                            .label(inboundType.desc)
                            .value(inboundType.getValue())
                            .build()
            );
        }
        return list;
    }

    public static String getOmsDesc(Integer value) {
        for (TransferOutboundStatusEnum inboundType : values()) {
            if (inboundType.getValue().equals(value)) {
                if (value > 0 && value < 4) {
                    return "仓库处理中";
                }
                return inboundType.desc;
            }
        }
        return null;
    }

    public static String getDescByValue(Integer value) {
        for (TransferOutboundStatusEnum inboundType : values()) {
            if (inboundType.value.equals(value)) {
                return inboundType.desc;
            }
        }
        return null;
    }
}
